<?php
$xtpl = new XTemplate("modules/home/support_online_task.htm");
//--
$UPLOAD = new UPLOAD();
//--
$POST = $_POST;

if($_POST[type] == 'NEW'){	
	
	$POST['name']=addslashes($POST['name']);
	$POST['nick']= addslashes($POST['nick']);
	$POST['type']=$POST['type_so'];
	
	//--
	$DB->DBInsert('support_online', $POST);
	//--
	$GUI->redir("?mod=home&act=support_online");
}
elseif($_POST[type] == 'EDIT'){
	
	$POST['name']=addslashes($POST['name']);
	$POST['nick']= addslashes($POST['nick']);
	$POST['type']=$POST['type_so'];
	//--

	$DB->DBUpdate('support_online', $POST, "WHERE id = '".$POST['id']."'");
	//--
	$GUI->redir("?mod=home&act=support_online");
}
//--
//--
if($_GET[id] != ''){
	$row = $DB->FetchData('support_online','*',"WHERE id='".$_GET[id]."'");
	
	$row[name]=stripslashes($row['name']);
	$row[id]=$row['id'];
	$row[nick] = $row['nick'];
	//--
	if($row['type']=='yahoo'){
 		$row['yahoo']='checked="checked"';
		$row['skype']='';
	}else{
		$row['yahoo']='';
		$row['skype']='checked="checked"';
	}
	$row[type] = 'EDIT';	
}else{
	$row[type] = 'NEW';
	$row['yahoo']='checked="checked"';
	$row['skype']='';
	//--	
}
//--
//--
//--

//--
$xtpl->assign("write",$row);
//--
//--
$waypathlink = '&raquo;&nbsp;<a href="?mod=home&act=support_online" class="waypath">Support Online Management</a>:&nbsp;'.$row[type];
$xtpl_main->assign("waypathlink",$waypathlink);
//--
//--
$save_button = $GUI->button_ren("Save","javascript: doSavenews();");
$xtpl->assign("save_button",$save_button);
//--
$cancel_button = $GUI->button_ren("Cancel","javascript: add('?mod=home&act=support_online');");
$xtpl->assign("cancel_button",$cancel_button);

//$xtpl->parse("center");
//$xtpl->assign("center_file",$xtpl->text("center"));

//--
//--
?>